<?php
session_start();
$email=$_SESSION['email'];

if(isset ($_GET['visugg'])){
                $key= $_GET['visugg'];//exit glossary when add new  suggestion
            }

if($_POST['Search'])
{
$key=$_POST['key'];  
}

if(isset ($_GET['viaddglo'])){
                $key= $_GET['viaddglo'];//view new added glossary
            }
				   /* if(isset ($_GET['msg'])){
                echo $_GET['msg'];
            }*/
//include_once('databaseconnection.php');

if(isset($_SESSION['lang']))
{
$lang=$_SESSION['lang'];

	$query = "SELECT * FROM terms WHERE language='$lang' AND (term LIKE '%$key%')";
	$query1 = "SELECT * FROM terms WHERE language='$lang' AND (accepted_meaning LIKE '%$key%')";
}	
else
{
$query = "SELECT * FROM terms WHERE term LIKE '%$key%'"; 
$query1 = "SELECT * FROM terms WHERE accepted_meaning LIKE '%$key%'"; 
}
 include ('header2.php');
 
 

 
$result = mysql_query($query);
$result2 = mysql_query($query1);
if ((mysql_num_rows($result) >= 1) || (mysql_num_rows($result2) >= 1)) 
  {
  
echo   "<table width='100%' height='82' border='1' class='table' align='left'>
<tr bgcolor='#FFFFFF'>


<th >Term</th>
<th>Domain</th>
<th>Accepted Meaning</th>
<th>Language</th>
<th>Votes</th>
<th>More</th>
</tr>";
if(mysql_num_rows($result) >= 1)
{
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td width='20%'>".$row['term']."</td>";
$term=$row['term'];
echo "<td width='15%'>".$row['domain']."</td>";
$acc_mean=$row['accepted_meaning'];
echo "<td width='35%'>".$row['accepted_meaning']."</td>";
echo "<td width='15%'>".$row['language']."</td>";
$votes=$row['votes'];
echo "<td width='7%'><a href='votes.php?err=$term.$acc_mean'>".$votes."</a></td>";
echo "<td width='3%'><a href='moredetails.php?li=$term.$acc_mean.$votes'>More</a></td>";
echo "</tr>";
}
}
if(mysql_num_rows($result2) >= 1)
{
while($row=mysql_fetch_array($result2))
{
echo "<tr>";
echo "<td width='20%'>".$row['term']."</td>";
$term=$row['term'];
echo "<td width='15%'>".$row['domain']."</td>";
$acc_mean=$row['accepted_meaning'];
echo "<td width='35%'>".$row['accepted_meaning']."</td>";
echo "<td width='15%'>".$row['language']."</td>";
$votes=$row['votes'];
echo "<td width='7%'><a href='votes.php?err=$term.$acc_mean'>".$votes."</a></td>";
echo "<td width='3%'><a href='moredetails.php?li=$term.$acc_mean.$votes'>More</a></td>";
echo "</tr>";
}
}
echo "</table>";      
} 
else
{  
 echo   "<table width='960px' height='82' border='1' class='table' align='left'>";
   echo "<tr><td>No results for your search</td></tr>";
   echo "</table>";  
}   
 
include ('footer.php');
?>




